
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
    set(LINKLIB odbc32)
else()
    set(LINKLIB odbc)
endif()

include_directories(.)
include_directories($ENV{ODBC_CSDK_INCL})
LINK_DIRECTORIES($ENV{ODBC_CSDK_LIB})

set (SRCS
    ${PROJECT_SOURCE_DIR}/src/topdbs_common.cpp
    ${PROJECT_SOURCE_DIR}/src/topdbs_base_session.cpp
    ${PROJECT_SOURCE_DIR}/src/topdbs_string.cpp
    ${PROJECT_SOURCE_DIR}/src/topdbs_field.cpp
    ${PROJECT_SOURCE_DIR}/src/topdbs_logutil.cpp
    odbc_common.cpp
    odbc_connection.cpp
    odbc_session.cpp
    )

if("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)   
endif()     
    
#set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)

add_library(topdbs_odbc  SHARED ${SRCS} )
target_link_libraries(topdbs_odbc  ${LINKLIB} )

install(TARGETS topdbs_odbc DESTINATION ${LIBRARY_INSTALL_PATH})

set (HEADERS
    odbc_common.hpp
    odbc_connection.hpp
    odbc_session.hpp
    )

install(FILES ${HEADERS} DESTINATION ${INCLUDE_INSTALL_PATH}/topdbs/odbc)
